package com.coda.service.impl;

import com.coda.entity.Brand;
import com.coda.mapper.BrandMapper;
import com.coda.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@CacheConfig(cacheNames = "brandCache")
@Service
public class BrandServiceImpl implements BrandService {

    @Autowired
    private BrandMapper brandMapper;

    /**
     * 查询所有品牌
     * @return
     */
    @Cacheable(key = "'all:brand'")
    @Override
    public List<Brand> getBrandList() {
        List<Brand> brandList = brandMapper.getBrandList();
        return brandList;
    }
}
